//$Id$

package builders;

/**
 * @author Vincent
 */
public class Building {

	private String buildingName;
	private String buildingImageFile;
	private int points;
	private int numberOfBuildingsAvailable;
	private BuildingRequirement[] buildingRequirement;

	/**
	 * This is the constructor of the Building class.
	 * 
	 * @param buildingName					specify the name of the building
	 * @param buildingImageFile				specify the file name of the image used by the building
	 * @param buildingPoints				specify the amount of points the player will gain if the player build this building
	 * @param numberOfBuildingAvailable		specify the number of the type of building available in the game
	 * @param buildingRequirement 
	 */
	public Building(String buildingName, String buildingImageFile,
			String buildingPoints, String numberOfBuildingAvailable, BuildingRequirement[] buildingRequirement) {
		this.buildingName = buildingName;
		this.buildingImageFile = buildingImageFile;
		this.points = Integer.valueOf(buildingPoints);
		this.numberOfBuildingsAvailable = Integer.valueOf(numberOfBuildingAvailable);
		this.buildingRequirement = buildingRequirement;
	}

	/**
	 * @return	the requirements required to buy the building specified in the argument
	 */
	public BuildingRequirement[] getBuildingRequirementList(){
		return buildingRequirement;
	}

	/**
	 * @return	the name of the building
	 */
	public String getName() {
		return buildingName;
	}

	/**
	 * @return	the file name of the image used by the building
	 */
	public String getImageFile() {
		return buildingImageFile;
	}

	/**
	 * @return	the amount of points the player will gain if the player build this building
	 */
	public int getPoints() {
		return points;
	}

	/**
	 * @return	the number of the type of building available in the game
	 */
	public int getNumberOfBuildingsAvailable() {
		return numberOfBuildingsAvailable;
	}

	/**
	 * this is method is called whenever a player build a building.
	 * the method will decrease the number of the type of building available in the game by 1
	 * 
	 * @return	true if at least 1 building is available, otherwise return false
	 */
	public boolean decreaseNumberOfBuildingsAvailable() {
		if (numberOfBuildingsAvailable > 0){
			numberOfBuildingsAvailable--;
			return true;
		}
		return false;
	}
}
